<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function fun(){
				console.log(`你${event.type}了按钮${event.target.innerHTML}`)
			}
		</script>
	</head>
	<body>
		<button>1</button>
		<button>2</button>
		<button>3</button>
		<button>4</button>
		<button>5</button>
		<button>6</button>
		<button>7</button>
		<button>8</button>
		<button>9</button>
		<button>10</button>
		<script type="text/javascript">
			const btns=document.getElementsByTagName("button")  //固定的值要加""
			for (var i = 0; i < btns.length; i++) {
				btns[i].onclick=fun
				btns[i].onmouseenter=fun
			}
		</script>
	</body>
</html>
